package com.hejia.alauda.entity;

import org.codehaus.jackson.annotate.JsonIgnoreProperties;

import javax.persistence.Column;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 *
 * Created by jimi on 14/12/3.
 */
@JsonIgnoreProperties(value = { "id", "createDate", "modifyDate", "createBy",
		"status", "available" })
public class SaleActivity extends BaseEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public enum Status {
		ONLINE, OFFLINE
	}

	public enum Tag {
		HOT, END
	}

	@Column
	private String name;

	@Column
	private String createBy;

	@Column
	private Status status;

	@Column
	private String description;// 活动描述

	@Column
	private Date startTime;

	@Column
	private Date endTime;

	@Column
	private String url;// 活动地址

	@Column
	private Long available;

	@Column
	private Integer orderBy;// 排序

	@Column
	private String h5Banner;// h5图片地址

	@Column
	private String iOSBanner;// iOS图片地址

	@Column
	private String androidBanner;// android图片地址

	@Column
	private String pcBanner;// pc图片地址

	@Column
	private boolean displayOnBanner;// 是否在banner上显示

	@Column
	private boolean displayInCenter;// 是否在活动给中心显示 （替代onlyOnBanner）

	@Column
	private boolean overdueHide;// 过期隐藏

//	@Column
//	private boolean onlyOnBanner;// 只在banner上显示

	@Column
	private boolean isFinish;// 已经结束

	@Column
	private Tag tag; // 标签

	public Long getAvailable() {
		return available;
	}

	public void setAvailable(Long available) {
		this.available = available;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getCreateBy() {
		return createBy;
	}

	public void setCreateBy(String createBy) {
		this.createBy = createBy;
	}

	public Status getStatus() {
		return status;
	}

	public void setStatus(Status status) {
		this.status = status;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Date getStartTime() {
		return startTime;
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

	public Date getEndTime() {
		return endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getStatusText() {
		String str = "下线";
		Status sta = getStatus();
		if (sta == null) {
			return "未设置";
		}
		switch (sta) {
		case OFFLINE:
			str = "下线";
			break;
		case ONLINE:
			str = "上线";
			break;
		}

		return str;
	}

	public Integer getOrderBy() {
		return orderBy;
	}

	public void setOrderBy(Integer orderBy) {
		this.orderBy = orderBy;
	}

	public String getH5Banner() {
		return h5Banner;
	}

	public void setH5Banner(String h5Banner) {
		this.h5Banner = h5Banner;
	}

	public String getiOSBanner() {
		return iOSBanner;
	}

	public void setiOSBanner(String iOSBanner) {
		this.iOSBanner = iOSBanner;
	}

	public String getAndroidBanner() {
		return androidBanner;
	}

	public void setAndroidBanner(String androidBanner) {
		this.androidBanner = androidBanner;
	}

	public boolean getIsFinish() {
		return isFinish;
	}

	public void setIsFinish(boolean isFinish) {
		this.isFinish = isFinish;
	}

	public String getFinish() {
		if (isFinish) {
			return "结束";
		} else {
			return "未结束";
		}
	}
	
	                 
	public String getActivityDescription(){
		SimpleDateFormat formatter = new SimpleDateFormat("MM月dd日");
		return "活动时间:"+formatter.format(startTime) + "到" + formatter.format(endTime);

	}

	public String getPcBanner() {
		return pcBanner;
	}

	public void setPcBanner(String pcBanner) {
		this.pcBanner = pcBanner;
	}

	public boolean isDisplayOnBanner() {
		return displayOnBanner;
	}

	public void setDisplayOnBanner(boolean displayOnBanner) {
		this.displayOnBanner = displayOnBanner;
	}

//	public boolean isOnlyOnBanner() {
//		return onlyOnBanner;
//	}
//
//	public void setOnlyOnBanner(boolean onlyOnBanner) {
//		this.onlyOnBanner = onlyOnBanner;
//	}

	public Tag getTag() {
		return tag;
	}

	public void setTag(Tag tag) {
		this.tag = tag;
	}

	public String getTagText() {
		String str = "";
		Tag t = getTag();
		if (t == null) {
			return "未设置";
		}
		switch (t) {
		case END:
			str = "结束";
			break;
		case HOT:
			str = "热门";
			break;
		}
		return str;
	}

	public boolean getDisplayInCenter() {
		return displayInCenter;
	}

	public void setDisplayInCenter(boolean displayInCenter) {
		this.displayInCenter = displayInCenter;
	}

	public boolean isOverdueHide() {
		return overdueHide;
	}

	public void setOverdueHide(boolean overdueHide) {
		this.overdueHide = overdueHide;
	}

	public void setFinish(boolean isFinish) {
		this.isFinish = isFinish;
	}
}
